package com.aweqy.hrmanager.controller;

import com.aweqy.hrmanager.entity.Room;
import com.aweqy.hrmanager.service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/api/rooms")
public class RoomController {
    @Autowired
    private RoomService roomService;

    @GetMapping
    public List<Room> list() {
        return roomService.list();
    }

    @PostMapping
    public boolean add(@RequestBody Room room) {
        return roomService.save(room);
    }

    @PutMapping
    public boolean update(@RequestBody Room room) {
        return roomService.updateById(room);
    }

    @DeleteMapping("/{id}")
    public boolean delete(@PathVariable Integer id) {
        return roomService.removeById(id);
    }
} 